package com.lzh.others;

import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @Description: 字符串与TIme转换
 * @Author: LiuZiHao
 * @Date: 2022/8/31 09:19
 */
public class DateTest {


    public static void main(String[] args) {

        String dateFormatRegex = "^(19|20)\\d\\d-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01]) ([01]\\d|2[0-3])$";
        String dateFormatRegex2 = "^(19|20)\\d\\d-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01]) ([01]\\d|2\\d)$";
        String dateStr = "2023/1/6";
        DateTime parse = DateUtil.parse(dateStr, "yyyy-MM-dd h","yyyy-MM-dd","yyyy/MM/dd");
        System.out.println("parse = " + parse);

    }
}
